package cn.yunhe.action;

import cn.yunhe.entity.House;
import cn.yunhe.service.NewsService;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;
@Controller
@Scope(value ="prototype")
@ParentPackage("struts-default")
public class HouseAction extends BaseAction {
    @Resource
    private NewsService newsService;
    @Action(value ="getAll",results = {
            @Result(location ="/succ.jsp")
    })

    public  String getAll() throws  Exception{
        List<House> houseList = newsService.getAllList();
        getMapRequest().put("houseList",houseList);
        return SUCCESS;
    }

    public NewsService getNewsService() {
        return newsService;
    }

    public void setNewsService(NewsService newsService) {
        this.newsService = newsService;
    }
}
